package com.toolbox.config;

import com.toolbox.aspect.TokenValidationAspectHandler;
import com.toolbox.handler.AccountContext;
import com.toolbox.service.JwtService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>
 * Description：账户自动配置
 * </p>
 *
 * @author Mango
 * @version v1.0.0
 * @date 2023-11-20 15:59
 * @see com.toolbox.config
 */
@SuppressWarnings("ALL")
@Configuration
@ConditionalOnClass({AccountContext.class})
public class AccountAutoConfiguration {

    /**
     * 将JwtService交由Spring控制
     *
     * @return
     */
    @Bean
    public JwtService tokenServiceBean() {
        return new JwtService();
    }

    /**
     * TokenValidation注解切面
     *
     * @return
     */
    @Bean
    public TokenValidationAspectHandler tokenValidationAspectHandler() {
        return new TokenValidationAspectHandler();
    }

}
